#Makefile for source files

include ../../mkfls_profs/Makefile.in
#include ./MakefileCheb.in
#include ./MakefileCheb_precise.in
#include MakefileBG.in

objfiles=\
 $(objfile_path)/mpi_mod.o \
 $(objfile_path)/openmp_nh3d_mod.o \
 $(objfile_path)/debug_tools_mod.o \
 $(objfile_path)/timing_mod.o \
 \
 $(objfile_path)/mpi_nh3d.o \
 $(objfile_path)/mpa_mycrds_sub.o \
 $(objfile_path)/pois_bounds_sub.o \
 $(objfile_path)/par_ex.o \
 $(objfile_path)/transpose_xy_yz_sub.o \
 $(objfile_path)/transpose_xz_xy_sub.o \
 $(objfile_path)/transpose_yz_xz_sub.o \
 $(objfile_path)/transpose_xy_y_sub.o \
 $(objfile_path)/transpose_y_x_sub.o \
 $(objfile_path)/transpose_x_xy_sub.o \
 $(objfile_path)/bcast_3darr_profile_sub.o \
 $(objfile_path)/bcast_scavar_sub.o \
 $(objfile_path)/bcast_arrvar_sub.o \
 $(objfile_path)/global_sum_2darr_func.o \
 $(objfile_path)/global_summod_2darr_func.o \
 $(objfile_path)/global_sumsquar_2darr_func.o \
 $(objfile_path)/abssuv_mpi_func.o \
 $(objfile_path)/arrgatherwri_mpi_sub.o \
 $(objfile_path)/free_requests_sub.o \
 $(objfile_path)/mpa_exch_new_sub.o \
 $(objfile_path)/stop_model_mpi_sub.o \
 $(objfile_path)/arrsectget_sub.o \
 $(objfile_path)/radbchexch_sub.o


 all : $(objfiles)

# Compiling module files

 $(objfile_path)/mpi_mod.o : mpi_mod.f90
	$(f90comp) $(opt_keys) $(check_keys) $(formfree_key) $(keys) $< -o $@
#	cp mpi_variables.mod $(module_path)
 $(objfile_path)/openmp_nh3d_mod.o : openmp_nh3d_mod.f90
	$(f90comp) $(opt_keys) $(check_keys) $(formfree_key) $(keys) $< -o $@
#	cp openmp_nh3d.mod $(module_path)
 $(objfile_path)/debug_tools_mod.o : debug_tools_mod.f90
	$(f90comp) $(opt_keys) $(check_keys) $(formfree_key) $(keys) $< -o $@
#	cp mpi_debug_tools.mod $(module_path)
 $(objfile_path)/timing_mod.o : timing_mod.f90
	$(f90comp) $(opt_keys) $(check_keys) $(formfree_key) $(keys) $< -o $@
#	cp timing_mod.mod $(module_path)

# Compiling other source files
 $(objfile_path)/%.o : %.f90 
	$(f90comp) $(opt_keys) $(check_keys) $(formfree_key) $(keys) $< -o $@

 $(objfile_path)/%.o : %.f
	$(f90comp) $(opt_keys) $(check_keys) $(formfixed_key) $(keys) $< -o $@


# Cleaning *.o and *.mod files
 clean : 
	rm -f $(objfiles)
